package com.haiya.command.mixcomposite;

public class Client {
    public static void main(String[] args) {
        ConcreteCommandA commandA = new ConcreteCommandA();
        ConcreteCommandB commandB = new ConcreteCommandB();
        ConcreteCommandC commandC = new ConcreteCommandC();
        ConcreteCommandD commandD = new ConcreteCommandD();

        Invoker invoker1 = new Invoker("invoker1");
        Invoker invoker2 = new Invoker("invoker2");

        /**
         *                   invoker1
         *                   /      \
         *               commandA   invoker2
         *                          / \         \
         *                    commandB commandC commandD
         */
        invoker1.add(commandA);
        invoker2.add(commandB);
        invoker2.add(commandC);
        invoker2.add(commandD);
        invoker1.add(invoker2);

        invoker1.execute();
    }
}
